<template>
  <div>
    <div class="app-container">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="货号" label="货号"/>
        <el-table-column label="价格信息(元)">
          <div slot-scope="scope" class="font12">
            <span>{{ scope.row['成交价'] }}*{{ scope.row['数量'] }}={{ scope.row['小计'] }}</span>
          </div>
        </el-table-column>
        <el-table-column prop="采购人" label="采购人"/>
        <el-table-column prop="加入购物车时间" label="加入购物车时间"/>
        <el-table-column prop="申请退货人姓名" label="申请退货人姓名"/>
        <el-table-column prop="申请退货原因" label="申请退货原因"/>
        <el-table-column prop="address" label="操作">
          <template slot-scope="scope">
            <el-button type="text" @click="updateAfterSale(scope.row,'26')">通过</el-button>
            <el-button type="text" @click="updateAfterSale(scope.row,'23')">拒绝</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { fetchList } from '@/api/api'
export default {
  data() {
    return {
      tableData: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    updateAfterSale(row, status) {
      const param = {
        query: 'vue_供货商订单售后_更新',
        订单状态: status,
        sysid: row.sysid
      }
      fetchList(param).then(({ data }) => {
        if (data.flag === '1') {
          this.$message.success('更新成功')
          this.getList()
        } else {
          this.$message.error('更新失败')
        }
      })
    },
    getList() {
      const param = {
        query: 'vue_订单售后_查询',
        供货商编号: localStorage.ghusername
      }
      fetchList(param).then(({ data }) => {
        if (data.flag === '1') {
          this.tableData = data.data
        } else {
          this.tableData = []
        }
      })
    }
  }
}
</script>

<style>
</style>
